/**
 * FileName: BusTypeController
 * Author:   秋水浮萍
 * Date:     2020/7/17 22:47
 * Description:
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.crm.crm.controller;
import com.crm.entity.SysDict;
import com.crm.entity.SysRegion;
import com.crm.system.service.SysDictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 〈一句话功能简述〉<br>
 * 〈〉
 *
 * @author 秋水浮萍
 * @create 2020/7/17
 * @since 1.0.0
 */
@Controller
public class CrmTypeController {
    @Autowired
    private SysDictService sysdictService;


    public static Map<String, Map<String, String>> vuleMap = new HashMap<>();
    public static Map<String, Map<String, String>> crmMap = new HashMap<>();
    public static Map<String, String> citys = new HashMap<>();

    @PostConstruct
    public void loads() {
        List<String> sysMap = sysdictService.listMap();
        List<SysRegion> listCity = sysdictService.listCity();
        List<SysDict> sysDictList = sysdictService.find();
        for (SysRegion city : listCity) {
            citys.put(city.getRegionId(), city.getRegionName());
        }

        for (String c : sysMap) {
            Map<String, String> maps = new HashMap<>();
            for (SysDict d : sysDictList) {
                if (c.equals(d.getGroupKey())) {
                    maps.put(d.getDicValue(), d.getDicKey());
                }
            }
            crmMap.put(c, maps);
        }


    }

}